package visiopuce.graph;

import java.awt.Color;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;

import visiopuce.HibernateUtil;
import visiopuce.DAO.ChampDAOImpl;
import visiopuce.objets.Alteration;
import visiopuce.objets.Annotation;
import visiopuce.objets.Bande;
import visiopuce.objets.BaseMicrorem;
import visiopuce.objets.Biomedecine;
import visiopuce.objets.CNPLyon;
import visiopuce.objets.CNPOuest;
import visiopuce.objets.CNPc;
import visiopuce.objets.Champ;
import visiopuce.objets.Clone32k;
import visiopuce.objets.Clone4k;
import visiopuce.objets.CloneTilepath;
import visiopuce.objets.DGVVariants;
import visiopuce.objets.GeneNcbi;
import visiopuce.objets.Isca;
import visiopuce.objets.Phenotype;
import visiopuce.objets.Probechr1;
import visiopuce.objets.Probechr10;
import visiopuce.objets.Probechr11;
import visiopuce.objets.Probechr12;
import visiopuce.objets.Probechr13;
import visiopuce.objets.Probechr14;
import visiopuce.objets.Probechr15;
import visiopuce.objets.Probechr16;
import visiopuce.objets.Probechr17;
import visiopuce.objets.Probechr18;
import visiopuce.objets.Probechr19;
import visiopuce.objets.Probechr2;
import visiopuce.objets.Probechr20;
import visiopuce.objets.Probechr21;
import visiopuce.objets.Probechr22;
import visiopuce.objets.Probechr3;
import visiopuce.objets.Probechr4;
import visiopuce.objets.Probechr5;
import visiopuce.objets.Probechr6;
import visiopuce.objets.Probechr7;
import visiopuce.objets.Probechr8;
import visiopuce.objets.Probechr9;
import visiopuce.objets.Probechrx;
import visiopuce.objets.Probechry;
import visiopuce.objets.Redon;
import visiopuce.objets.Resultat;
import visiopuce.objets.SiteFragile;
import visiopuce.objets.TypePuce;
import visiopuce.objets.VerifBiomol;
import visiopuce.objets.VerifFish;
import visiopuce.service.AlterationServiceImpl;
import visiopuce.service.PersonneServiceImpl;
import visiopuce.service.PrelevementServiceImpl;
import visiopuce.service.PuceServiceImpl;
import visiopuce.service.ReferentielServiceImpl;
import visiopuce.service.ResultatServiceImpl;

public class OutilsBande2 {

	// private static Color COLOR_CNPc = Color.orange;
	// private static Color COLOR_CNP = Color.red;
	private static Color COLOR_CAUSAL0 = Color.black;
	private static Color COLOR_CAUSAL1 = new Color(255, 0, 0);
	private static Color COLOR_CAUSAL2 = new Color(209, 0, 233);
	private static Color COLOR_CAUSAL3 = new Color(255, 246, 0);
	private static Color COLOR_CAUSAL4 = new Color(6, 255, 0);
	private static Color COLOR_CAUSAL5 = new Color(0, 255, 246);
	private static Color COLOR_CAUSAL6 = new Color(255, 255, 255);
	private Color couleurContour = Color.black;
	private Color couleurTexte = Color.black;
	private String chromosome;
	private long debut;
	private long fin;
	private HashMap<Integer, List<FloatingBar>> cnvChevauchants;
	private HashMap<Integer, List<FloatingBar>> cnvChevauchantsDel;
	private HashMap<Integer, List<FloatingBar>> cnvChevauchantsDup;
	private HashMap<Integer, Integer> ordreCNV;
	private HashMap<Integer, Integer> ordreCNVDup;
	private HashMap<Integer, Integer> ordreCNVDel;
	private HashMap<Long, Integer> resultADel0;
	private HashMap<Long, Integer> resultADup3;
	private HashMap<Long, Integer> resultNADel0;
	private HashMap<Long, Integer> resultNADup3;
	private HashMap<Long, Integer> resultADel1;
	private HashMap<Long, Integer> resultADup4;
	private HashMap<Long, Integer> resultNADel1;
	private HashMap<Long, Integer> resultNADup4;
	private HashMap<Long, Integer> resultALCSH;
	private HashMap<Long, Integer> resultAMOZ;
	private HashMap<Long, Integer> resultNALCSH;
	private HashMap<Long, Integer> resultNAMOZ;
	private long pas;
	private GraphCytog graphCytog;
	private FloatingBarSeries floatingBarseriesBande = null;
	private FloatingBarSeries floatingBarseriesRedon = null;
	private List<FloatingBar> barresDGV = null;
	private ArrayList<FloatingBar> barresISCA;
	private FloatingBarSeries floatingBarseriesCNPC;
	private ArrayList<FloatingBar> barresClone32k;
	private List<FloatingBar> barresClonetilepath;
	private List<FloatingBar> barresClone4k;
	private List<FloatingBar> barresCnpLyon;
	private List<FloatingBar> barresGeneNCBI;
	private List<FloatingBar> barresCnpOuest;
	private FloatingBarSeries floatingBarseriesFragile;
	private List<FloatingBarSeries> floatingBarBaseMicroRem;
	private FloatingBarSeries floatingBarseriesEuchro;
	private FloatingBarSeries floatingBarseriesImprinting;
	private FloatingBarSeries floatingBarseriesProbe;
	private int seuil = 0;

	public OutilsBande2(GraphCytog graphCytog, String chromosome, long debut, long fin, int seuil) {
		this.graphCytog = graphCytog;
		this.chromosome = chromosome;
		this.debut = debut;
		this.fin = fin;
		this.pas = 1000;
		resultADel0 = new HashMap<Long, Integer>();
		resultADup3 = new HashMap<Long, Integer>();
		resultNADel0 = new HashMap<Long, Integer>();
		resultNADup3 = new HashMap<Long, Integer>();
		resultADel1 = new HashMap<Long, Integer>();
		resultADup4 = new HashMap<Long, Integer>();
		resultNADel1 = new HashMap<Long, Integer>();
		resultNADup4 = new HashMap<Long, Integer>();
		resultALCSH = new HashMap<Long, Integer>();
		resultAMOZ = new HashMap<Long, Integer>();
		resultNALCSH = new HashMap<Long, Integer>();
		resultNAMOZ = new HashMap<Long, Integer>();
		this.seuil = seuil;
		createTableau(seuil);
	}

	private void createTableau(int seuil) {
		cnvChevauchants = new HashMap<Integer, List<FloatingBar>>();
		cnvChevauchantsDel = new HashMap<Integer, List<FloatingBar>>();
		cnvChevauchantsDup = new HashMap<Integer, List<FloatingBar>>();
		ordreCNV = new HashMap<Integer, Integer>();
		ordreCNVDup = new HashMap<Integer, Integer>();
		ordreCNVDel = new HashMap<Integer, Integer>();
		int ordre = 0;
		int ordreDel = 0;
		int ordreDup = 0;
		int type = 2;
		// List<Alteration> cnvChs =
		// AlterationServiceImpl.getInstance().getCNVChevauchant(graphCytog.getAlteration(),
		// seuil);
		//
		//
		//
		//
		// if (cnvChs != null && cnvChs.size() > 0) {
		// for (Alteration cnvChevauchant : cnvChs) {
		//
		// // récupération des données
		// Long start = new Long(0);
		// Long end = new Long(0);
		// int idAlteration = 0;
		// int idPuce = 0;
		// String phentoype = "";
		// String sexe = "I";
		//
		// start = cnvChevauchant.getDebutHg19();
		// end = cnvChevauchant.getFinHg19();
		// idAlteration = cnvChevauchant.getIdAlteration();
		// idPuce = cnvChevauchant.getPuce().getIdPuce();
		// type = (int) cnvChevauchant.getNbCopie();
		// Biomedecine bm =
		// PuceServiceImpl.getInstance().getIndicationByIdPuce(cnvChevauchant.getPuce().getIdPuce());
		// phentoype = bm.getLibelle();
		// sexe =
		// PuceServiceImpl.getInstance().getSexePersonneByIdPuce(cnvChevauchant.getPuce().getIdPuce());
		// boolean estPatient =
		// PuceServiceImpl.getInstance().getIsPatientByIdPuce(cnvChevauchant.getPuce().getIdPuce());
		// // Properties prop = new Properties();
		//
		// // creation du lien
		// String link = "afficheCNV.php?idAlteration=" + idAlteration;
		//
		// // creation du tooltip
		// String tooltip = "";
		//
		// if (phentoype != null && !phentoype.equals("")) {
		// tooltip = "<u>Indication</u> : " + formatString(phentoype) + "<br/>";
		// } else {
		// if (estPatient) {
		// tooltip = "<u>Indication</u> : non renseigné<br/>";
		// } else {
		// tooltip = "<u>Indication</u> : parent<br/>";
		// }
		// }
		// tooltip += "<u>Validation</u> : ";
		//
		// /*
		// * System.out.println("ligne:"+ligne);
		// * System.out.println("14:"+donnees[14]);
		// * System.out.println("15:"+donnees[15]);
		// * System.out.println("16:"+donnees[16]);
		// */
		// Color couleurT = Color.black;
		// if (!cnvChevauchant.isaVerifBioMol()) {
		//
		// tooltip += "qPCR non demandée<br/>";
		// } else {
		// List<VerifBiomol> vbm =
		// ResultatServiceImpl.getInstance().getVerifBiomolByIdAlteration(cnvChevauchant.getIdAlteration());
		// if (vbm != null && vbm.size() > 0 && vbm.get(0) != null) {
		// if (vbm.get(0).getRenduBiomol() == null ||
		// (vbm.get(0).getRenduBiomol() != null &&
		// vbm.get(0).getRenduBiomol().getValide() != 3)) {
		// tooltip += "qPCR demandée mais non encore réalisée<br/>";
		// couleurT = Color.WHITE;
		// } else {
		// if (vbm != null && vbm.get(0) != null && vbm.get(0).getDetecte() ==
		// 0) {
		// tooltip += "qPCR réalisée : CNV non validé<br/>";
		// couleurT = new Color(222, 131, 0);
		// }
		// if (vbm != null && vbm.get(0) != null && vbm.get(0).getDetecte() ==
		// 1) {
		// tooltip += "qPCR réalisée : CNV validé<br/>";
		// couleurT = new Color(0, 131, 0);
		// }
		// if (vbm != null && vbm.get(0) != null && vbm.get(0).getDetecte() ==
		// 2) {
		// tooltip += "qPCR réalisée : résultat ininterprétable<br/>";
		// couleurT = new Color(0, 131, 0);
		// }
		// }
		//
		// }
		// }
		// if (!cnvChevauchant.isaVerifFish()) {
		// tooltip += "FISH non demandée<br/>";
		// } else {
		// List<VerifFish> vf =
		// ResultatServiceImpl.getInstance().getVerifFishByIdAlteration(cnvChevauchant.getIdAlteration());
		// if (vf != null && vf.size() > 0 && vf.get(0) != null) {
		// if (vf.get(0).getRenduFish() == null || (vf.get(0).getRenduFish() !=
		// null && vf.get(0).getRenduFish().getValide() != 3)) {
		//
		// tooltip += "FISH demandée mais non encore réalisée<br/>";
		// couleurT = Color.WHITE;
		// } else {
		// if (vf != null && vf.get(0) != null && !vf.get(0).getDetecte()) {
		// tooltip += "FISH réalisée : CNV non validé<br/>";
		// couleurT = new Color(222, 131, 0);
		// }
		// if (vf != null && vf.get(0) != null && vf.get(0).getDetecte()) {
		// tooltip += "FISH réalisée : CNV validé<br/>";
		// couleurT = new Color(0, 131, 0);
		// }
		// }
		// }
		// }
		// List<Resultat> rps =
		// ResultatServiceImpl.getInstance().getResultatByIdPuce(cnvChevauchant.getPuce().getIdPuce());
		// for (Resultat rp : rps) {
		// if (rp != null && rp.getDateRendu() != null) {
		// tooltip += "<u>Formule chromosomique du patient</u> : " +
		// rp.getFormule() + "<br/>";
		// } else {
		// tooltip +=
		// "<u>Formule chromosomique du patient</u> : puce non rendue<br/>";
		// }
		// }
		//
		// // creation de la description
		// String description = "";
		// description = "MPL";
		// description += "-" +
		// PuceServiceImpl.getInstance().getIdPersonneByIdPuce(cnvChevauchant.getPuce().getIdPuce());
		// if (estPatient) {
		// description += "(A/";
		// } else {
		// description += "(N.A/";
		// }
		// description += sexe + ")";
		// TypePuce typePuceObj =
		// PuceServiceImpl.getInstance().getTypePuceByIdPuce(cnvChevauchant.getPuce().getIdPuce());
		// String typePuce = typePuceObj.getLibelle();
		// String typePuceAbrev = null;
		// if (typePuce.equals("Cytogenetics Whole-Genome 2.7M")) {
		// typePuceAbrev = "2.7M";
		// } else {
		// if (typePuce.equals("SurePrint G3 Human CGH Microarray 4x180K")) {
		// typePuceAbrev = "4x180K";
		// // if ($r ["numero"] != 4 && $r ["numero"] != 3) {
		// // $causale = 6;
		// // }
		// } else if
		// (typePuce.equals("SurePrint G3 Human CGH Microarray 8x60K")) {
		// typePuceAbrev = "8x60K";
		// // if ($r ["numero"] != 4 && $r ["numero"] != 3) {
		// // $causale = 6;
		// // }
		// } else {
		// typePuceAbrev = typePuce;
		// }
		// }
		// description += "-" +
		// typePuceObj.getMarquePuce().getLibelle().substring(0, 3) +
		// typePuceAbrev;
		//
		// // creation de la couleur
		// Color couleur = new Color(230, 250, 254);
		//
		// if (type == -100) {
		// couleur = GraphCytog.COLOR_CNV_LCSH;
		// } else if (type == -1000) {
		// couleur = GraphCytog.COLOR_CNV_MOZ;
		// } else {
		// if (!chromosome.equals("Y") && !chromosome.equals("X")) {
		// switch (type) {
		// case 0:
		// couleur = GraphCytog.COLOR_CNV_0;
		// break;
		// case 1:
		// couleur = GraphCytog.COLOR_CNV_1;
		// break;
		// case 2:
		// couleur = GraphCytog.COLOR_CNV_2;
		// break;
		// case 3:
		// couleur = GraphCytog.COLOR_CNV_3;
		// break;
		// case 4:
		// couleur = GraphCytog.COLOR_CNV_4;
		// break;
		// default:
		// couleur = GraphCytog.COLOR_CNV_2;
		// break;
		// }
		// } else {
		// if (sexe.equals("M")) {
		// switch (type) {
		// case 0:
		// couleur = GraphCytog.COLOR_CNV_1;
		// break;
		// case 1:
		// couleur = GraphCytog.COLOR_CNV_2;
		// break;
		// case 2:
		// couleur = GraphCytog.COLOR_CNV_3;
		// break;
		// case 3:
		// couleur = GraphCytog.COLOR_CNV_4;
		// break;
		// default:
		// couleur = GraphCytog.COLOR_CNV_2;
		// break;
		// }
		//
		// } else if (sexe.equals("F")) {
		// if (chromosome.equals("Y")) {
		// switch (type) {
		// case 0:
		// couleur = GraphCytog.COLOR_CNV_1;
		// break;
		// default:
		// couleur = GraphCytog.COLOR_CNV_2;
		// break;
		// }
		// } else if (chromosome.equals("X")) {
		// switch (type) {
		// case 0:
		// couleur = GraphCytog.COLOR_CNV_0;
		// break;
		// case 1:
		// couleur = GraphCytog.COLOR_CNV_1;
		// break;
		// case 2:
		// couleur = GraphCytog.COLOR_CNV_2;
		// break;
		// case 3:
		// couleur = GraphCytog.COLOR_CNV_3;
		// break;
		// case 4:
		// couleur = GraphCytog.COLOR_CNV_4;
		// break;
		// default:
		// couleur = GraphCytog.COLOR_CNV_2;
		// break;
		// }
		// }
		// }
		// }
		// }
		//
		// // creation du contour
		// Color couleurC = Color.black;
		// List<Annotation> anots =
		// AlterationServiceImpl.getInstance().getAnnotationsByAlteration(cnvChevauchant.getIdAlteration());
		// if (anots != null && anots.size() > 0) {
		// Annotation anot = anots.get(anots.size() - 1);
		// if (anot.getCausale().getIdTypeCausal() == 0) {
		// couleurC = COLOR_CAUSAL0;
		// } else if (anot.getCausale().getIdTypeCausal() == 1) {
		// couleurC = COLOR_CAUSAL1;
		// } else if (anot.getCausale().getIdTypeCausal() == 2) {
		// couleurC = COLOR_CAUSAL2;
		// } else if (anot.getCausale().getIdTypeCausal() == 3) {
		// couleurC = COLOR_CAUSAL3;
		// } else if (anot.getCausale().getIdTypeCausal() == 4) {
		// couleurC = COLOR_CAUSAL4;
		// } else if (anot.getCausale().getIdTypeCausal() == 5) {
		// couleurC = COLOR_CAUSAL5;
		// } else {
		// couleurC = COLOR_CAUSAL6;
		// }
		// }
		// FloatingBar floatingBar = new FloatingBar(description, start, end,
		// couleur, tooltip, link, couleurC, couleurT);
		//
		// // ajout de l'odre et de la floating bar aux listes
		//
		// if (!ordreCNV.containsValue(idPuce)) {
		// ordreCNV.put(ordre, idPuce);
		// ordre++;
		// }
		// if (!ordreCNVDel.containsValue(idPuce) &&
		// (floatingBar.getColor().equals(GraphCytog.COLOR_CNV_1) ||
		// floatingBar.getColor().equals(GraphCytog.COLOR_CNV_0))) {
		// ordreCNVDel.put(ordreDel, idPuce);
		// ordreDel++;
		// }
		// if (!ordreCNVDup.containsValue(idPuce) &&
		// (floatingBar.getColor().equals(GraphCytog.COLOR_CNV_3) ||
		// floatingBar.getColor().equals(GraphCytog.COLOR_CNV_4))) {
		// ordreCNVDup.put(ordreDup, idPuce);
		// ordreDup++;
		// }
		// List<FloatingBar> listeFB = null;
		// if (!cnvChevauchants.containsKey(idPuce)) {
		// listeFB = new ArrayList<FloatingBar>();
		// } else {
		// listeFB = cnvChevauchants.get(idPuce);
		// }
		// listeFB.add(floatingBar);
		// cnvChevauchants.put(idPuce, listeFB);
		// if (floatingBar.getColor().equals(GraphCytog.COLOR_CNV_1) ||
		// floatingBar.getColor().equals(GraphCytog.COLOR_CNV_0)) {
		// List<FloatingBar> listeFBDel = null;
		// if (!cnvChevauchantsDel.containsKey(idPuce)) {
		// listeFBDel = new ArrayList<FloatingBar>();
		// } else {
		// listeFBDel = cnvChevauchantsDel.get(idPuce);
		// }
		// listeFBDel.add(floatingBar);
		// cnvChevauchantsDel.put(idPuce, listeFBDel);
		// }
		// if (floatingBar.getColor().equals(GraphCytog.COLOR_CNV_3) ||
		// floatingBar.getColor().equals(GraphCytog.COLOR_CNV_4)) {
		// List<FloatingBar> listeFBDup = null;
		// if (!cnvChevauchantsDup.containsKey(idPuce)) {
		// listeFBDup = new ArrayList<FloatingBar>();
		// } else {
		// listeFBDup = cnvChevauchantsDup.get(idPuce);
		// }
		// listeFBDup.add(floatingBar);
		// cnvChevauchantsDup.put(idPuce, listeFBDup);
		// }
		//
		// long s = ((long) (start / pas)) * pas;
		// for (long position = s; position < end; position += pas) {
		// if (!resultADel0.containsKey(position)) {
		// resultADel0.put(position, 0);
		// }
		// if (!resultADup3.containsKey(position)) {
		// resultADup3.put(position, 0);
		// }
		// if (!resultNADel0.containsKey(position)) {
		// resultNADel0.put(position, 0);
		// }
		// if (!resultNADup3.containsKey(position)) {
		// resultNADup3.put(position, 0);
		// }
		// if (!resultADel1.containsKey(position)) {
		// resultADel1.put(position, 0);
		// }
		// if (!resultADup4.containsKey(position)) {
		// resultADup4.put(position, 0);
		// }
		// if (!resultNADel1.containsKey(position)) {
		// resultNADel1.put(position, 0);
		// }
		// if (!resultNADup4.containsKey(position)) {
		// resultNADup4.put(position, 0);
		// }
		// if (!resultALCSH.containsKey(position)) {
		// resultALCSH.put(position, 0);
		// }
		// if (!resultAMOZ.containsKey(position)) {
		// resultAMOZ.put(position, 0);
		// }
		// if (!resultNALCSH.containsKey(position)) {
		// resultNALCSH.put(position, 0);
		// }
		// if (!resultNAMOZ.containsKey(position)) {
		// resultNAMOZ.put(position, 0);
		// }
		// if (estPatient) {
		// if (type == -100) {
		// resultALCSH.put(position, resultALCSH.get(position) + 1);
		// }
		// if (type == -1000) {
		// resultAMOZ.put(position, resultAMOZ.get(position) + 1);
		// }
		// } else {
		// if (type == -100) {
		// resultNALCSH.put(position, resultNALCSH.get(position) + 1);
		// }
		// if (type == -1000) {
		// resultNAMOZ.put(position, resultNAMOZ.get(position) + 1);
		// }
		// }
		// if (!chromosome.equals("X") && !chromosome.equals("Y")) {
		// if (estPatient) {
		// if (type == 0) {
		// resultADel0.put(position, resultADel0.get(position) - 1);
		// } else if (type == 1) {
		// resultADel1.put(position, resultADel1.get(position) - 1);
		// } else if (type == 3) {
		// resultADup3.put(position, resultADup3.get(position) + 1);
		// } else if (type == 4) {
		// resultADup4.put(position, resultADup4.get(position) + 1);
		// }
		// } else {
		// if (type == 0) {
		// resultNADel0.put(position, resultNADel0.get(position) - 1);
		// } else if (type == 1) {
		// resultNADel1.put(position, resultNADel1.get(position) - 1);
		// } else if (type == 3) {
		// resultNADup3.put(position, resultNADup3.get(position) + 1);
		// } else if (type == 4) {
		// resultNADup4.put(position, resultNADup4.get(position) + 1);
		// }
		// }
		// } else if (sexe.equals("F")) {
		// if (chromosome.equals("X")) {
		// if (estPatient) {
		// if (type == 0) {
		// resultADel0.put(position, resultADel0.get(position) - 1);
		// } else if (type == 1) {
		// resultADel1.put(position, resultADel1.get(position) - 1);
		// } else if (type == 3) {
		// resultADup3.put(position, resultADup3.get(position) + 1);
		// } else if (type == 4) {
		// resultADup4.put(position, resultADup4.get(position) + 1);
		// }
		// } else {
		// if (type == 0) {
		// resultNADel0.put(position, resultNADel0.get(position) - 1);
		// } else if (type == 1) {
		// resultNADel1.put(position, resultNADel1.get(position) - 1);
		// } else if (type == 3) {
		// resultNADup3.put(position, resultNADup3.get(position) + 1);
		// } else if (type == 4) {
		// resultNADup4.put(position, resultNADup4.get(position) + 1);
		// }
		// }
		// } else if (chromosome.equals("Y")) {
		// if (estPatient) {
		// if (type == 1) {
		// resultADup3.put(position, resultADup3.get(position) + 1);
		// } else if (type > 1) {
		// resultADup4.put(position, resultADup4.get(position) + 1);
		// }
		// } else {
		// if (type == 1) {
		// resultNADup3.put(position, resultNADup3.get(position) + 1);
		// } else if (type > 1) {
		// resultNADup4.put(position, resultNADup4.get(position) + 1);
		// }
		// }
		// }
		// } else if (sexe.equals("M")) {
		// if (chromosome.equals("X") || chromosome.equals("Y")) {
		// if (estPatient) {
		// if (type == 0) {
		// resultADel0.put(position, resultADel0.get(position) - 1);
		// } else if (type == 2) {
		// resultADup3.put(position, resultADup3.get(position) + 1);
		// } else if (type > 2) {
		// resultADup4.put(position, resultADup4.get(position) + 1);
		// }
		// } else {
		// if (type == 0) {
		// resultNADel0.put(position, resultNADel0.get(position) - 1);
		// } else if (type == 2) {
		// resultNADup3.put(position, resultNADup3.get(position) + 1);
		// } else if (type > 2) {
		// resultNADup4.put(position, resultNADup4.get(position) + 1);
		// }
		// }
		// }
		// }
		// }
		// }

		// }

		List cnvChs = AlterationServiceImpl.getInstance().getCNVChevauchant4Graph(graphCytog.getAlteration(), seuil);

		if (cnvChs != null && cnvChs.size() > 0) {
			for (Object obj : cnvChs) {
				Object[] tableau = (Object[]) obj;

				// récupération des données
				Long start = new Long(0);
				Long end = new Long(0);
				int idAlteration = 0;
				int idPuce = 0;
				int idPrelevement = 0;
				int idPersonne = 0;
				String phenotype = "";
				String biomed = "";
				String sexe = "I";

				Alteration cnvChevauchant = (Alteration) tableau[0];
				// creation de la description
				String description = (String) tableau[1];
				
				
				idPuce = cnvChevauchant.getPuce().getIdPuce();
				
				
				sexe = PuceServiceImpl.getInstance().getSexePersonneByIdPuce(idPuce);
				if (sexe.isEmpty() ) {
					HibernateUtil.beginTransaction();
					sexe = ChampDAOImpl.getInstance().getSexeFoetusByIdPuce(idPuce);
					HibernateUtil.commitTransaction();
					HibernateUtil.closeSession();
				}
				if (sexe == null){
					sexe = "I";
				}

				// if (estPatient) {
				// description += "(A/";
				// } else {
				// description += "(N.A/";
				// }
				description += "("+ sexe + ")";
				// TypePuce typePuceObj =
				// PuceServiceImpl.getInstance().getTypePuceByIdPuce(cnvChevauchant.getPuce().getIdPuce());
				String typePuce = (String) tableau[2];

				start = cnvChevauchant.getDebutHg19();
				end = cnvChevauchant.getFinHg19();
				idAlteration = cnvChevauchant.getIdAlteration();
				

				idPrelevement = (int) tableau[5];
				idPersonne = (int) tableau[7];

				String secteur = (String) tableau[8];

				type = (int) cnvChevauchant.getNbCopie();

				biomed = (String) tableau[4];
				phenotype = (String) tableau[6];

				// Biomedecine bm =
				// PuceServiceImpl.getInstance().getIndicationByIdPuce(cnvChevauchant.getPuce().getIdPuce());
				String indication = "";

				if (!biomed.contains("utre") && biomed.equals("non renseigné")) {
					indication = phenotype + " - ";
				}
				if (secteur.contains("rénatal")) {
					Champ ctSigneAppel = PrelevementServiceImpl.getInstance().getChampByTypeAndIdObjet("tSigneAppel", "Prel-" + idPrelevement);
					if (biomed.contains("ignes d'appel")) {
						if (ctSigneAppel != null) {
							indication = "Signes d'appel échographique : " + ctSigneAppel.getValeur() + " - ";
						}
					} else {
						if (ctSigneAppel != null) {
							indication += "signes d'appel échographique : " + ctSigneAppel.getValeur() + " - ";
						}
					}
				}
				if (phenotype != null) {
					indication += phenotype + " - ";
				}
				ArrayList<Phenotype> pheno = PersonneServiceImpl.getInstance().getPhenotypesByIdPersonne(idPersonne);
				if (pheno != null) {
					for (Phenotype phenotyped : pheno) {
						if (!indication.toLowerCase().contains(phenotyped.getLibelle().toLowerCase())) {
							indication += phenotyped.getLibelle() + " - ";
						}
					}
				}

				if (indication.length() > 3) {

					indication = indication.substring(0, indication.length() - 3) + ".";
				}

				// sexe =
				// PuceServiceImpl.getInstance().getSexePersonneByIdPuce(cnvChevauchant.getPuce().getIdPuce());
				// boolean estPatient =
				// PuceServiceImpl.getInstance().getIsPatientByIdPuce(cnvChevauchant.getPuce().getIdPuce());
				// // Properties prop = new Properties();
				//
				// creation du lien
				String link = "afficheCNV.php?idAlteration=" + idAlteration;

				// creation du tooltip
				String tooltip = "";

				if (indication != null && !indication.equals("")) {
					tooltip = "<u>Indication</u> : " + formatString(indication) + "<br/>";
				} else {
					tooltip = "<u>Indication</u> : non renseigné<br/>";
				}
				tooltip += "<u>Validation</u> : ";

				Color couleurT = Color.black;
				if (!cnvChevauchant.isaVerifBioMol()) {
					tooltip += "qPCR non demandée";
				} else {
					List<VerifBiomol> vbm = ResultatServiceImpl.getInstance().getVerifBiomolByIdAlteration(cnvChevauchant.getIdAlteration());
					if (vbm != null && vbm.size() > 0) {
						for (VerifBiomol vvbm : vbm) {

							if (vvbm.getDetecte() != null) {
								if (vvbm.getDetecte() == 1) {
									tooltip += "CNV détecté par qPCR. ";
									couleurT = new Color(0, 131, 0);
									if (vvbm.getHerite() == null) {
										tooltip += "Origine parentale non vérifiée.";
									} else {
										tooltip += vvbm.getHerite() + ". ";
									}
								} else if (vvbm.getDetecte() == 0) {
									tooltip += "CNV non détecté par qPCR. ";
									couleurT = new Color(222, 131, 0);
								} else if (vvbm.getDetecte() == 2) {
									tooltip += "CNV ininterprétable en qPCR. ";
									couleurT = new Color(222, 131, 0);
								}
							}

						}
					} else {
						couleurT = Color.WHITE;
						tooltip += "qPCR demandée";
					}

				}

				if (!cnvChevauchant.isaVerifFish()) {
					tooltip += "FISH non demandée";
				} else {
					List<VerifFish> vf = ResultatServiceImpl.getInstance().getVerifFishByIdAlteration(cnvChevauchant.getIdAlteration());
					if (vf != null && vf.size() > 0) {
						for (VerifFish vvf : vf) {
							if (vvf.getDetecte() != null && vvf.getDetecte()) {
								tooltip += "CNV détecté par FISH. ";
								couleurT = new Color(0, 131, 0);
								if (vvf.getHerite() == null) {
									tooltip += "Origine parentale non vérifiée.";

								} else {
									tooltip += vvf.getHerite() + ". ";
								}
							} else if (vvf.getDetecte() == null) {
								tooltip += "FISH demandée";
							} else if (!vvf.getDetecte()) {
								tooltip += "CNV non détecté par FISH. ";
								couleurT = new Color(0, 131, 0);
							}

						}
					} else {
						couleurT = Color.WHITE;
						tooltip += "qPCR demandée";
					}
				}
				tooltip += "<br/>";
				List<String> formulesPuces = ResultatServiceImpl.getInstance().getFormuleResultatByIdPuce(cnvChevauchant.getPuce().getIdPuce());
				for (String formulePuce : formulesPuces) {

					tooltip += "<u>Formule chromosomique du patient</u> : " + formulePuce + "<br/>";

				}
				if (formulesPuces == null || formulesPuces.size() == 0) {
					tooltip += "<u>Formule chromosomique du patient</u> : puce non rendue<br/>";
				}
				// a, p.sexe, p.patient, p.idPersonne, u.idPuce,
				// u.typePuce.libelle, u.typePuce.marquePuce.libelle,
				// pr.indication.libelle

				String typePuceAbrev = null;
				if (typePuce.equals("Cytogenetics Whole-Genome 2.7M")) {
					typePuceAbrev = "2.7M";
				} else {
					if (typePuce.equals("SurePrint G3 Human CGH Microarray 4x180K")) {
						typePuceAbrev = "4x180K";
						// if ($r ["numero"] != 4 && $r ["numero"] != 3) {
						// $causale = 6;
						// }
					} else if (typePuce.equals("SurePrint G3 Human CGH Microarray 8x60K")) {
						typePuceAbrev = "8x60K";
						// if ($r ["numero"] != 4 && $r ["numero"] != 3) {
						// $causale = 6;
						// }
					} else {
						typePuceAbrev = typePuce;
					}
				}
				description += "-" + ((String) tableau[3]).substring(0, 3) + typePuceAbrev;

				// creation de la couleur
				Color couleur = new Color(230, 250, 254);

				if (type == -100) {
					couleur = GraphCytog.COLOR_CNV_LCSH;
				} else if (type == -1000) {
					couleur = GraphCytog.COLOR_CNV_MOZ;
				} else {
					if (!chromosome.equals("Y") && !chromosome.equals("X")) {
						switch (type) {
						case 0:
							couleur = GraphCytog.COLOR_CNV_0;
							break;
						case 1:
							couleur = GraphCytog.COLOR_CNV_1;
							break;
						case 2:
							couleur = GraphCytog.COLOR_CNV_2;
							break;
						case 3:
							couleur = GraphCytog.COLOR_CNV_3;
							break;
						case 4:
							couleur = GraphCytog.COLOR_CNV_4;
							break;
						default:
							couleur = GraphCytog.COLOR_CNV_2;
							break;
						}
					} else {
						if (sexe.equals("M")) {
							switch (type) {
							case 0:
								couleur = GraphCytog.COLOR_CNV_1;
								break;
							case 1:
								couleur = GraphCytog.COLOR_CNV_2;
								break;
							case 2:
								couleur = GraphCytog.COLOR_CNV_3;
								break;
							case 3:
								couleur = GraphCytog.COLOR_CNV_4;
								break;
							default:
								couleur = GraphCytog.COLOR_CNV_2;
								break;
							}

						} else if (sexe.equals("F")) {
							if (chromosome.equals("Y")) {
								switch (type) {
								case 0:
									couleur = GraphCytog.COLOR_CNV_1;
									break;
								default:
									couleur = GraphCytog.COLOR_CNV_2;
									break;
								}
							} else if (chromosome.equals("X")) {
								switch (type) {
								case 0:
									couleur = GraphCytog.COLOR_CNV_0;
									break;
								case 1:
									couleur = GraphCytog.COLOR_CNV_1;
									break;
								case 2:
									couleur = GraphCytog.COLOR_CNV_2;
									break;
								case 3:
									couleur = GraphCytog.COLOR_CNV_3;
									break;
								case 4:
									couleur = GraphCytog.COLOR_CNV_4;
									break;
								default:
									couleur = GraphCytog.COLOR_CNV_2;
									break;
								}
							}
						}
					}
				}

				// creation du contour
				Color couleurC = Color.black;
				int idTypeCausal = AlterationServiceImpl.getInstance().getIdTypeCausalByAlteration(cnvChevauchant.getIdAlteration());
				if (idTypeCausal == 0) {
					couleurC = COLOR_CAUSAL0;
				} else if (idTypeCausal == 1) {
					couleurC = COLOR_CAUSAL1;
				} else if (idTypeCausal == 2) {
					couleurC = COLOR_CAUSAL2;
				} else if (idTypeCausal == 3) {
					couleurC = COLOR_CAUSAL3;
				} else if (idTypeCausal == 4) {
					couleurC = COLOR_CAUSAL4;
				} else if (idTypeCausal == 5) {
					couleurC = COLOR_CAUSAL5;
				} else {
					couleurC = COLOR_CAUSAL6;
				}

				FloatingBar floatingBar = new FloatingBar(description, start, end, couleur, tooltip, link, couleurC, couleurT);

				// ajout de l'odre et de la floating bar aux listes

				if (!ordreCNV.containsValue(idPuce)) {
					ordreCNV.put(ordre, idPuce);
					ordre++;
				}
				if (!ordreCNVDel.containsValue(idPuce) && (floatingBar.getColor().equals(GraphCytog.COLOR_CNV_1) || floatingBar.getColor().equals(GraphCytog.COLOR_CNV_0))) {
					ordreCNVDel.put(ordreDel, idPuce);
					ordreDel++;
				}
				if (!ordreCNVDup.containsValue(idPuce) && (floatingBar.getColor().equals(GraphCytog.COLOR_CNV_3) || floatingBar.getColor().equals(GraphCytog.COLOR_CNV_4))) {
					ordreCNVDup.put(ordreDup, idPuce);
					ordreDup++;
				}
				List<FloatingBar> listeFB = null;
				if (!cnvChevauchants.containsKey(idPuce)) {
					listeFB = new ArrayList<FloatingBar>();
				} else {
					listeFB = cnvChevauchants.get(idPuce);
				}
				listeFB.add(floatingBar);
				cnvChevauchants.put(idPuce, listeFB);
				if (floatingBar.getColor().equals(GraphCytog.COLOR_CNV_1) || floatingBar.getColor().equals(GraphCytog.COLOR_CNV_0)) {
					List<FloatingBar> listeFBDel = null;
					if (!cnvChevauchantsDel.containsKey(idPuce)) {
						listeFBDel = new ArrayList<FloatingBar>();
					} else {
						listeFBDel = cnvChevauchantsDel.get(idPuce);
					}
					listeFBDel.add(floatingBar);
					cnvChevauchantsDel.put(idPuce, listeFBDel);
				}
				if (floatingBar.getColor().equals(GraphCytog.COLOR_CNV_3) || floatingBar.getColor().equals(GraphCytog.COLOR_CNV_4)) {
					List<FloatingBar> listeFBDup = null;
					if (!cnvChevauchantsDup.containsKey(idPuce)) {
						listeFBDup = new ArrayList<FloatingBar>();
					} else {
						listeFBDup = cnvChevauchantsDup.get(idPuce);
					}
					listeFBDup.add(floatingBar);
					cnvChevauchantsDup.put(idPuce, listeFBDup);
				}

				// long s = ((long) (start / pas)) * pas;
				// for (long position = s; position < end; position += pas) {
				// if (!resultADel0.containsKey(position)) {
				// resultADel0.put(position, 0);
				// }
				// if (!resultADup3.containsKey(position)) {
				// resultADup3.put(position, 0);
				// }
				// if (!resultNADel0.containsKey(position)) {
				// resultNADel0.put(position, 0);
				// }
				// if (!resultNADup3.containsKey(position)) {
				// resultNADup3.put(position, 0);
				// }
				// if (!resultADel1.containsKey(position)) {
				// resultADel1.put(position, 0);
				// }
				// if (!resultADup4.containsKey(position)) {
				// resultADup4.put(position, 0);
				// }
				// if (!resultNADel1.containsKey(position)) {
				// resultNADel1.put(position, 0);
				// }
				// if (!resultNADup4.containsKey(position)) {
				// resultNADup4.put(position, 0);
				// }
				// if (!resultALCSH.containsKey(position)) {
				// resultALCSH.put(position, 0);
				// }
				// if (!resultAMOZ.containsKey(position)) {
				// resultAMOZ.put(position, 0);
				// }
				// if (!resultNALCSH.containsKey(position)) {
				// resultNALCSH.put(position, 0);
				// }
				// if (!resultNAMOZ.containsKey(position)) {
				// resultNAMOZ.put(position, 0);
				// }
				// if (estPatient) {
				// if (type == -100) {
				// resultALCSH.put(position, resultALCSH.get(position) + 1);
				// }
				// if (type == -1000) {
				// resultAMOZ.put(position, resultAMOZ.get(position) + 1);
				// }
				// } else {
				// if (type == -100) {
				// resultNALCSH.put(position, resultNALCSH.get(position) + 1);
				// }
				// if (type == -1000) {
				// resultNAMOZ.put(position, resultNAMOZ.get(position) + 1);
				// }
				// }
				// if (!chromosome.equals("X") && !chromosome.equals("Y")) {
				// if (estPatient) {
				// if (type == 0) {
				// resultADel0.put(position, resultADel0.get(position) - 1);
				// } else if (type == 1) {
				// resultADel1.put(position, resultADel1.get(position) - 1);
				// } else if (type == 3) {
				// resultADup3.put(position, resultADup3.get(position) + 1);
				// } else if (type == 4) {
				// resultADup4.put(position, resultADup4.get(position) + 1);
				// }
				// } else {
				// if (type == 0) {
				// resultNADel0.put(position, resultNADel0.get(position) - 1);
				// } else if (type == 1) {
				// resultNADel1.put(position, resultNADel1.get(position) - 1);
				// } else if (type == 3) {
				// resultNADup3.put(position, resultNADup3.get(position) + 1);
				// } else if (type == 4) {
				// resultNADup4.put(position, resultNADup4.get(position) + 1);
				// }
				// }
				// } else if (sexe.equals("F")) {
				// if (chromosome.equals("X")) {
				// if (estPatient) {
				// if (type == 0) {
				// resultADel0.put(position, resultADel0.get(position) - 1);
				// } else if (type == 1) {
				// resultADel1.put(position, resultADel1.get(position) - 1);
				// } else if (type == 3) {
				// resultADup3.put(position, resultADup3.get(position) + 1);
				// } else if (type == 4) {
				// resultADup4.put(position, resultADup4.get(position) + 1);
				// }
				// } else {
				// if (type == 0) {
				// resultNADel0.put(position, resultNADel0.get(position) - 1);
				// } else if (type == 1) {
				// resultNADel1.put(position, resultNADel1.get(position) - 1);
				// } else if (type == 3) {
				// resultNADup3.put(position, resultNADup3.get(position) + 1);
				// } else if (type == 4) {
				// resultNADup4.put(position, resultNADup4.get(position) + 1);
				// }
				// }
				// } else if (chromosome.equals("Y")) {
				// if (estPatient) {
				// if (type == 1) {
				// resultADup3.put(position, resultADup3.get(position) + 1);
				// } else if (type > 1) {
				// resultADup4.put(position, resultADup4.get(position) + 1);
				// }
				// } else {
				// if (type == 1) {
				// resultNADup3.put(position, resultNADup3.get(position) + 1);
				// } else if (type > 1) {
				// resultNADup4.put(position, resultNADup4.get(position) + 1);
				// }
				// }
				// }
				// } else if (sexe.equals("M")) {
				// if (chromosome.equals("X") || chromosome.equals("Y")) {
				// if (estPatient) {
				// if (type == 0) {
				// resultADel0.put(position, resultADel0.get(position) - 1);
				// } else if (type == 2) {
				// resultADup3.put(position, resultADup3.get(position) + 1);
				// } else if (type > 2) {
				// resultADup4.put(position, resultADup4.get(position) + 1);
				// }
				// } else {
				// if (type == 0) {
				// resultNADel0.put(position, resultNADel0.get(position) - 1);
				// } else if (type == 2) {
				// resultNADup3.put(position, resultNADup3.get(position) + 1);
				// } else if (type > 2) {
				// resultNADup4.put(position, resultNADup4.get(position) + 1);
				// }
				// }
				// }
				// }
				// }

			}
		}
	}

	public HashMap<Integer, List<FloatingBar>> getCNVChevauchantCNV() {
		return cnvChevauchants;
	}

	public HashMap<Integer, List<FloatingBar>> getCNVChevauchantDelCNV() {
		return cnvChevauchantsDel;
	}

	public HashMap<Integer, List<FloatingBar>> getCNVChevauchantDupCNV() {
		return cnvChevauchantsDup;
	}

	public HashMap<Integer, Integer> getOrdreCNVChevauchantCNV() {
		return ordreCNV;
	}

	public HashMap<Integer, Integer> getOrdreCNVChevauchantDupCNV() {
		return ordreCNVDup;
	}

	public HashMap<Integer, Integer> getOrdreCNVChevauchantDelCNV() {
		return ordreCNVDel;
	}

	public List<FloatingBar> getCNVsBaseByIdPuce(int idPuce) {
		return cnvChevauchants.get(idPuce);
	}

	public List<FloatingBar> getCNVsDelBaseByIdPuce(int idPuce) {
		return cnvChevauchantsDel.get(idPuce);
	}

	public List<FloatingBar> getCNVsDupBaseByIdPuce(int idPuce) {
		return cnvChevauchantsDup.get(idPuce);
	}

	public List<double[][]> calculeCNVPosition() {

		List<double[][]> r = new ArrayList<double[][]>();
		double[][] resultADel0Tab = new double[2][(int) ((fin / pas) + 1)];
		double[][] resultADup3Tab = new double[2][(int) ((fin / pas) + 1)];
		double[][] resultNADel0Tab = new double[2][(int) ((fin / pas) + 1)];
		double[][] resultNADup3Tab = new double[2][(int) ((fin / pas) + 1)];

		double[][] resultADel1Tab = new double[2][(int) ((fin / pas) + 1)];
		double[][] resultADup4Tab = new double[2][(int) ((fin / pas) + 1)];
		double[][] resultNADel1Tab = new double[2][(int) ((fin / pas) + 1)];
		double[][] resultNADup4Tab = new double[2][(int) ((fin / pas) + 1)];

		double[][] resultAMOZTab = new double[2][(int) ((fin / pas) + 1)];
		double[][] resultALCSHTab = new double[2][(int) ((fin / pas) + 1)];
		double[][] resultNAMOZTab = new double[2][(int) ((fin / pas) + 1)];
		double[][] resultNALCSHTab = new double[2][(int) ((fin / pas) + 1)];

		int j = 0;
		long s = ((long) (debut / pas)) * pas;
		for (long i = s; i < fin; i += pas) {
			resultADel0Tab[0][j] = i + (pas / 2);
			resultADel1Tab[0][j] = i + (pas / 2);
			resultNADel0Tab[0][j] = i + (pas / 2);
			resultNADel1Tab[0][j] = i + (pas / 2);

			resultADup3Tab[0][j] = i + (pas / 2);
			resultADup4Tab[0][j] = i + (pas / 2);
			resultNADup3Tab[0][j] = i + (pas / 2);
			resultNADup4Tab[0][j] = i + (pas / 2);

			resultAMOZTab[0][j] = i + (pas / 2);
			resultALCSHTab[0][j] = i + (pas / 2);
			resultNAMOZTab[0][j] = i + (pas / 2);
			resultNALCSHTab[0][j] = i + (pas / 2);

			resultADel0Tab[1][j] = 0;
			resultADel1Tab[1][j] = 0;
			resultNADel0Tab[1][j] = 0;
			resultNADel1Tab[1][j] = 0;

			resultADup3Tab[1][j] = 0;
			resultADup4Tab[1][j] = 0;
			resultNADup3Tab[1][j] = 0;
			resultNADup4Tab[1][j] = 0;

			resultAMOZTab[1][j] = 0;
			resultALCSHTab[1][j] = 0;
			resultNAMOZTab[1][j] = 0;
			resultNALCSHTab[1][j] = 0;

			if (resultADel0.get(i) != null) {
				resultADel0Tab[1][j] = resultADel0.get(i);
			}
			if (resultADel1.get(i) != null) {
				resultADel1Tab[1][j] = resultADel1.get(i);
			}
			if (resultADup3.get(i) != null) {
				resultADup3Tab[1][j] = resultADup3.get(i);
			}
			if (resultADup4.get(i) != null) {
				resultADup4Tab[1][j] = resultADup4.get(i);
			}
			if (resultNADel0.get(i) != null) {
				resultNADel0Tab[1][j] = resultNADel0.get(i);
			}
			if (resultNADel1.get(i) != null) {
				resultNADel1Tab[1][j] = resultNADel1.get(i);
			}
			if (resultNADup3.get(i) != null) {
				resultNADup3Tab[1][j] = resultNADup3.get(i);
			}
			if (resultNADup4.get(i) != null) {
				resultNADup4Tab[1][j] = resultNADup4.get(i);
			}
			if (resultAMOZ.get(i) != null) {
				resultAMOZTab[1][j] = resultAMOZ.get(i);
			}
			if (resultALCSH.get(i) != null) {
				resultALCSHTab[1][j] = resultALCSH.get(i);
			}
			if (resultNAMOZ.get(i) != null) {
				resultNAMOZTab[1][j] = resultNAMOZ.get(i);
			}
			if (resultNALCSH.get(i) != null) {
				resultNALCSHTab[1][j] = resultNALCSH.get(i);
			}
			j++;
		}
		r.add(resultADel0Tab);
		r.add(resultADel1Tab);
		r.add(resultADup3Tab);
		r.add(resultADup4Tab);
		r.add(resultNADel0Tab);
		r.add(resultNADel1Tab);
		r.add(resultNADup3Tab);
		r.add(resultNADup4Tab);
		r.add(resultNAMOZTab);
		r.add(resultAMOZTab);
		r.add(resultNALCSHTab);
		r.add(resultALCSHTab);
		return r;
	}

	public FloatingBarSeries getBandesChrBandes() {
		if (floatingBarseriesBande == null) {
			floatingBarseriesBande = new FloatingBarSeries("Bandes");
			List<Bande> bandes = ReferentielServiceImpl.getInstance().getBandesByChromosome(graphCytog.getAlteration().getChromosome());
			for (Bande bande : bandes) {

				Color couleur = new Color(255, 0, 0);
				if (bande.getType().equals("gneg")) {
					couleur = new Color(254, 254, 254);
				} else if (bande.getType().equals("gpos25")) {
					couleur = new Color(192, 192, 192);
				} else if (bande.getType().equals("gpos50")) {
					couleur = new Color(169, 169, 169);
				} else if (bande.getType().equals("gpos75")) {
					couleur = new Color(100, 100, 100);
				} else if (bande.getType().equals("gpos100")) {
					couleur = new Color(0, 0, 0);
				} else if (bande.getType().equals("acen")) {
					couleur = new Color(78, 51, 112);
				} else if (bande.getType().equals("gvar")) {
					couleur = new Color(110, 98, 124);
				} else if (bande.getType().equals("stalk")) {
					couleur = new Color(128, 128, 128);
				}
				String tooltip = bande.getChromosome() + bande.getLibelle();
				String link = "Pas de lien";
				FloatingBar floatingBar = new FloatingBar(bande.getChromosome() + bande.getLibelle(), bande.getDebutHg19(), bande.getFinHg19(), couleur, tooltip, link, couleurContour, couleurTexte);
				floatingBarseriesBande.add(floatingBar);

			}
		}
		return floatingBarseriesBande;
	}

	public List<FloatingBar> getDGVVariantsBandes() {
		if (barresDGV == null) {
			barresDGV = new ArrayList<FloatingBar>();
			List<DGVVariants> dgvVariants = ReferentielServiceImpl.getInstance().getDGVVariantsByBorne(graphCytog.getAlteration(), seuil);
			for (DGVVariants dgvVariant : dgvVariants) {
				String libelle = dgvVariant.getIdVariant();
				String tooltip = "";
				tooltip += "<u>N° DGV</u> : " + dgvVariant.getIdVariant() + "<br/>";

				tooltip += "<u>Type</u> : " + dgvVariant.getVarianttype() + "( " + dgvVariant.getVariantsubtype() + ")<br/>";

				if (dgvVariant.getReference() != null) {
					tooltip += "<u>Référence</u> : " + dgvVariant.getReference() + "(pubmedid : " + dgvVariant.getPubmedid() + ")<br/>";
				}
				if (dgvVariant.getMethod() != null) {
					tooltip += "<u>Méthode</u> : " + dgvVariant.getMethod() + "<br/>";
				}
				if (dgvVariant.getPlatform() != null) {
					tooltip += "<u>Plateforme</u> : " + dgvVariant.getPlatform() + "<br/>";
				}
				if (dgvVariant.getMergedorsample().equals("M")) {

					tooltip += "<u>CNV unique</u>" + "<br/>";
				} else if (dgvVariant.getMergedorsample().equals("S")) {
					tooltip += "<u>CNV mergé</u> : " + dgvVariant.getSamplesize() + "<br/>";
				}

				tooltip += "<u>Taille de l'échantillon</u> : " + dgvVariant.getSamplesize() + "( " + dgvVariant.getObservedgains() + " gain(s) et " + dgvVariant.getObservedlosses() + " perte(s))<br/>";
				if (dgvVariant.getCohortdescription() != null) {
					tooltip += "<u>Description de la cohorte</u> : " + dgvVariant.getCohortdescription() + "<br/>";
				}
				if (dgvVariant.getSamples() != null) {
					tooltip += "<u>Samples</u> : " + dgvVariant.getSamples() + "<br/>";
				}

				tooltip += "<u>Position</u>  : " + dgvVariant.getChr() + ":" + dgvVariant.getStart() + "-" + dgvVariant.getEnd() + "<br/>";

				String link = "http://dgv.tcag.ca/dgv/app/variant?id=" + dgvVariant.getIdVariant() + "&ref=GRCh37/hg19";

				long start = dgvVariant.getStart();
				long end = dgvVariant.getEnd();
				Color couleur = new Color(254, 254, 34);
				if (dgvVariant.getVariantsubtype().equals("Insertion") || dgvVariant.getVariantsubtype().equals("Gain") || dgvVariant.getVariantsubtype().equals("Duplication")) {
					couleur = GraphCytog.COLOR_CNV_3;
				} else if (dgvVariant.getVariantsubtype().equals("Loss") || dgvVariant.getVariantsubtype().equals("Deletion")) {
					couleur = GraphCytog.COLOR_CNV_1;
				}

				FloatingBar floatingBar = new FloatingBar(libelle, start, end, couleur, tooltip, link, couleurContour, couleurTexte);
				floatingBar.setTitreLigne(dgvVariant.getReference());
				barresDGV.add(floatingBar);
			}
		}
		return barresDGV;
	}

	public List<FloatingBar> getISCABandes() {
		if (barresISCA == null) {
			barresISCA = new ArrayList<FloatingBar>();
			List<Isca> iscas = ReferentielServiceImpl.getInstance().getIscaByBorne(graphCytog.getAlteration(), seuil);
			for (Isca isca : iscas) {
				String libelle = isca.getLibelle();
				String dupdel = "";
				Color couleur = null;
				Color cContour = null;
				if (isca.getDupdel() == 1) {
					dupdel = "duplication";
					couleur = GraphCytog.COLOR_CNV_4;
				}
				if (isca.getDupdel() == -1) {
					dupdel = "deletion";
					couleur = GraphCytog.COLOR_CNV_0;
				}
				if (isca.getAnnotation().equals("Uncertain")) {
					cContour = COLOR_CAUSAL6;
				}
				if (isca.getAnnotation().equals("Pathogenic")) {
					cContour = COLOR_CAUSAL1;
				}
				if (isca.getAnnotation().equals("Likely_Pathogenic")) {
					cContour = COLOR_CAUSAL2;
				}
				if (isca.getAnnotation().equals("Likely_Benign")) {
					cContour = COLOR_CAUSAL4;
				}
				if (isca.getAnnotation().equals("Benign")) {
					cContour = COLOR_CAUSAL5;
				}

				String link = isca.getLien();
				String tooltip = "<u>Type</u> : " + dupdel + "<br/>";
				tooltip += "<u>Position</u> : " + isca.getChromosome() + ":" + isca.getDebutHg19() + "-" + isca.getFinHg19() + "<br/>";
				tooltip += "<u>Annotation</u> : " + isca.getAnnotation() + "<br/>";

				long start = isca.getDebutHg19();
				long end = isca.getFinHg19();

				FloatingBar floatingBar = new FloatingBar(libelle, start, end, couleur, tooltip, link, cContour, couleurTexte);
				barresISCA.add(floatingBar);
			}
		}
		return barresISCA;
	}

	public FloatingBarSeries getRedonBandes() {
		if (floatingBarseriesRedon == null) {
			floatingBarseriesRedon = new FloatingBarSeries("CNV Redon");
			List<Redon> redons = ReferentielServiceImpl.getInstance().getRedonByBorne(graphCytog.getAlteration(), seuil);
			for (Redon redon : redons) {
				String libelle = redon.getChromosome() + ":" + redon.getDebutHg19() + "-" + redon.getFinHg19() + "<br/>";
				String tooltip = "<u>Position</u> : " + libelle + "<br/>";
				String link = "http://www.ensembl.org/Homo_sapiens/Location/View?r=" + libelle;
				long start = redon.getDebutHg19();
				long end = redon.getFinHg19();
				Color couleur = new Color(188, 29, 234);
				FloatingBar floatingBar = new FloatingBar(libelle, start, end, couleur, tooltip, link, couleurContour, couleurTexte);
				floatingBarseriesRedon.add(floatingBar);
			}
		}
		return floatingBarseriesRedon;
	}

	public FloatingBarSeries getCnpcBandes() {
		if (floatingBarseriesCNPC == null) {
			floatingBarseriesCNPC = new FloatingBarSeries("CNP MPL");
			List<CNPc> cnpsc = ReferentielServiceImpl.getInstance().getCNPcByBorne(graphCytog.getAlteration(), seuil);
			for (CNPc cnpc : cnpsc) {
				String libelle = cnpc.getChromosome() + ":" + cnpc.getDebutHg19() + "-" + cnpc.getFinHg19() + "X" + cnpc.getNbCopie();
				String link = "http://www.ensembl.org/Homo_sapiens/Location/View?r=" + cnpc.getChromosome() + ":" + cnpc.getDebutHg19() + "-" + cnpc.getFinHg19();
				String tooltip = "<u>Nombre de copies</u> : " + cnpc.getNbCopie() + "<br/>";
				tooltip += "<u>Position</u> : " + cnpc.getChromosome() + ":" + cnpc.getDebutHg19() + "-" + cnpc.getFinHg19() + "<br/>";
				long start = cnpc.getDebutHg19();
				long end = cnpc.getFinHg19();
				Color c = new Color(230, 250, 254);
				FloatingBar floatingBar = new FloatingBar(libelle, start, end, c, tooltip, link, couleurContour, couleurTexte);
				floatingBarseriesCNPC.add(floatingBar);
			}
		}
		return floatingBarseriesCNPC;
	}

	public List<FloatingBar> getClone32kBandes() {
		if (barresClone32k == null) {
			barresClone32k = new ArrayList<FloatingBar>();
			List<Clone32k> clones32k = ReferentielServiceImpl.getInstance().getClone32kByBorne(graphCytog.getAlteration(), seuil);
			for (Clone32k clone32k : clones32k) {
				String libelle = clone32k.getIdClone();
				String link = "http://www.ensembl.org/Homo_sapiens/Location/View?r=" + clone32k.getChromosome() + ":" + clone32k.getDebutHg19() + "-" + clone32k.getFinHg19();
				String tooltip = "<u>Nom</u> : " + libelle + "<br/>";
				tooltip += "<u>Position</u> : " + clone32k.getChromosome() + ":" + clone32k.getDebutHg19() + "-" + clone32k.getFinHg19() + "<br/>";
				long start = clone32k.getDebutHg19();
				long end = clone32k.getFinHg19();
				Color c = new Color(100, 248, 100);
				FloatingBar floatingBar = new FloatingBar(libelle, start, end, c, tooltip, link, couleurContour, couleurTexte);
				barresClone32k.add(floatingBar);
			}
		}
		return barresClone32k;
	}

	public List<FloatingBar> getClonetilepathBandes() {
		if (barresClonetilepath == null) {
			barresClonetilepath = new ArrayList<FloatingBar>();

			List<CloneTilepath> clonesTilePath = ReferentielServiceImpl.getInstance().getCloneTilepathByBorne(graphCytog.getAlteration(), seuil);
			for (CloneTilepath cloneTilePath : clonesTilePath) {
				String libelle = cloneTilePath.getIdCloneTilepath();
				String link = "http://www.ensembl.org/Homo_sapiens/Location/View?r=" + cloneTilePath.getChromosome() + ":" + cloneTilePath.getDebutHg19() + "-" + cloneTilePath.getFinHg19();
				String tooltip = "<u>Nom</u> : " + libelle + "<br/>";
				tooltip += "<u>Position</u> : " + cloneTilePath.getChromosome() + ":" + cloneTilePath.getDebutHg19() + "-" + cloneTilePath.getFinHg19() + "<br/>";
				long start = cloneTilePath.getDebutHg19();
				long end = cloneTilePath.getFinHg19();
				Color c = new Color(100, 248, 200);
				FloatingBar floatingBar = new FloatingBar(libelle, start, end, c, tooltip, link, couleurContour, couleurTexte);
				barresClonetilepath.add(floatingBar);
			}
		}
		return barresClonetilepath;
	}

	public List<FloatingBar> getClone4kBandes() {
		if (barresClone4k == null) {
			barresClone4k = new ArrayList<FloatingBar>();
			List<Clone4k> clones4k = ReferentielServiceImpl.getInstance().getClone4kByBorne(graphCytog.getAlteration(), seuil);
			for (Clone4k clone4k : clones4k) {
				String libelle = clone4k.getId().getIdClone();
				String link = "http://www.ensembl.org/Homo_sapiens/Location/View?r=" + clone4k.getChromosome() + ":" + clone4k.getDebutHg19() + "-" + clone4k.getFinHg19();
				String tooltip = "<u>Nom</u> : " + libelle + "<br/>";
				tooltip += "<u>Boite</u> : " + clone4k.getId().getBoite() + "<br/>";
				tooltip += "<u>Position</u> : " + clone4k.getChromosome() + ":" + clone4k.getDebutHg19() + "-" + clone4k.getFinHg19() + "<br/>";
				long start = clone4k.getDebutHg19();
				long end = clone4k.getFinHg19();
				Color c = new Color(157, 117, 200);
				FloatingBar floatingBar = new FloatingBar(libelle, start, end, c, tooltip, link, couleurContour, couleurTexte);
				barresClone4k.add(floatingBar);
			}
		}
		return barresClone4k;
	}

	public List<FloatingBar> getCnpLyon() {
		if (barresCnpLyon == null) {
			barresCnpLyon = new ArrayList<FloatingBar>();
			List<CNPLyon> cnpsLyon = ReferentielServiceImpl.getInstance().getCNPLyonByBorne(graphCytog.getAlteration(), seuil);
			for (CNPLyon cnpLyon : cnpsLyon) {
				String libelle = cnpLyon.getType() + " " + cnpLyon.getChromosome() + ":" + cnpLyon.getDebutHg19() + "-" + cnpLyon.getFinHg19();
				String link = "Pas de lien";
				String tooltip = libelle;
				long start = cnpLyon.getDebutHg19();
				long end = cnpLyon.getFinHg19();
				Color c = null;
				if (cnpLyon.getType().equals("Gain")) {
					c = GraphCytog.COLOR_CNV_3;
				}
				if (cnpLyon.getType().equals("Triplication")) {
					c = GraphCytog.COLOR_CNV_4;
				}
				if (cnpLyon.getType().equals("Gain")) {
					c = GraphCytog.COLOR_CNV_1;
				}
				if (cnpLyon.getType().equals("Perte ou gain")) {
					c = COLOR_CAUSAL6;
				}
				FloatingBar floatingBar = new FloatingBar(libelle, start, end, c, tooltip, link, couleurContour, couleurTexte);
				barresCnpLyon.add(floatingBar);
			}
		}
		return barresCnpLyon;
	}

	public List<FloatingBar> getCnpOuest() {
		if (barresCnpOuest == null) {
			barresCnpOuest = new ArrayList<FloatingBar>();
			List<CNPOuest> cnpsOuest = ReferentielServiceImpl.getInstance().getCNPOuestByBorne(graphCytog.getAlteration(), seuil);
			for (CNPOuest cnpOuest : cnpsOuest) {
				String libelle = cnpOuest.getTypePuce() + " " + cnpOuest.getLaboratoire();
				String link = "Pas de lien";
				String tooltip = "Conf.:" + cnpOuest.getConfirmation() + ", Herité:" + cnpOuest.getHerite();
				if (cnpOuest.getConfirmationParentale() != null) {
					tooltip += ", Conf. parents:" + cnpOuest.getConfirmationParentale();
				}
				long start = cnpOuest.getDebutHg19();
				long end = cnpOuest.getFinHg19();
				Color c = null;
				if (cnpOuest.getAnomalie().equals("duplication")) {
					c = GraphCytog.COLOR_CNV_3;
				}
				if (cnpOuest.getAnomalie().equals("triplication")) {
					c = GraphCytog.COLOR_CNV_4;
				}
				if (cnpOuest.getAnomalie().equals("deletion")) {
					c = GraphCytog.COLOR_CNV_1;
				}

				FloatingBar floatingBar = new FloatingBar(libelle, start, end, c, tooltip, link, couleurContour, couleurTexte);
				barresCnpOuest.add(floatingBar);
			}
		}
		return barresCnpOuest;
	}

	public List<FloatingBar> getGeneNCBIBandes() {
		if (barresGeneNCBI == null) {
			barresGeneNCBI = new ArrayList<FloatingBar>();
			List<GeneNcbi> genesNCBI = ReferentielServiceImpl.getInstance().getGeneNCBIByBorne(graphCytog.getAlteration(), seuil);
			for (GeneNcbi geneNcbi : genesNCBI) {
				String tumorSupp = "";
				String rm = "";
				String type = "";
				String libelle = "";
				libelle = geneNcbi.getSymbol();
				tumorSupp = geneNcbi.getTumorSupp().trim();
				rm = geneNcbi.getRm().trim();
				type = geneNcbi.getType().trim();
				String tooltip = "<u>Symbol</u> : " + libelle + "<br/>";
				tooltip += "<u>Type</u> : " + type + "<br/>";
				if (geneNcbi.getOrientation().equals("+")) {
					tooltip += "<u>Orientation</u> : ====&gt;&gt; <br/>";
				}
				if (geneNcbi.getOrientation().equals("-")) {
					tooltip += "<u>Orientation</u> : &lt;&lt;==== <br/>";
				}

				tooltip += "<u>Nom</u> : " + geneNcbi.getDescription() + "<br/>";

				String link = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&amp;cmd=retrieve&amp;dopt=full_report&amp;list_uids=" + geneNcbi.getId().getIdNcbi();
				long start = geneNcbi.getDebutHg19();
				long end = geneNcbi.getFinHg19();

				Color couleur;
				if (type.equals("mRNA")) {
					couleur = new Color(255, 255, 102);
				} else if (type.equals("protein")) {
					couleur = new Color(255, 153, 0);
				} else if (type.equals("best RefSeq")) {
					couleur = new Color(51, 204, 0);
				} else if (type.equals("par")) {
					couleur = new Color(223, 113, 255);
					link = "";
					tooltip += "<u>Remarque</u> : région pseudo-autosomique<br/>";
				} else {
					couleur = new Color(0, 0, 0);
				}
				Color cContour = couleurContour;
				if (tumorSupp.trim().equals("Dominant")) {
					cContour = new Color(255, 0, 0);
					tooltip += "<u>Cancer</u> : Prédisposition aux cancers (Dominant)<br/>";

				} else if (tumorSupp.trim().equals("Récessif")) {
					cContour = new Color(255, 0, 0);
					tooltip += "<u>Cancer</u> : Prédisposition aux cancers (Récessif)<br/>";
				}
				if (rm.trim().equals("ASD Implicated")) {
					cContour = new Color(186, 0, 255);
					tooltip += "<u>Remarque</u> : Impliqué dans les troubles envahissants du développement (Autisme)<br/>";

				} else if (rm.trim().equals("id")) {
					cContour = new Color(186, 0, 255);
					tooltip += "<u>Remarque</u> : Impliqué dans le retard mental<br/>";
				} else if (rm.trim().equals("ASD candidate")) {
					cContour = new Color(186, 0, 255);
					tooltip += "<u>Remarque</u> : Gêne candidat pour être impliqué dans les troubles envahissants du développement (Autisme)<br/>";
				} else if (rm.trim().equals("déf.int")) {
					cContour = new Color(186, 0, 255);
					tooltip += "<u>Remarque</u> : Gênes préalablement impliqués dans la déficience intellectuelle (projet NGS MR)<br/>";
				}
				FloatingBar floatingBar = new FloatingBar(libelle, start, end, couleur, tooltip, link, cContour, couleurTexte);
				barresGeneNCBI.add(floatingBar);
			}
		}
		return barresGeneNCBI;
	}

	public FloatingBarSeries getFragile() {
		if (floatingBarseriesFragile == null) {
			floatingBarseriesFragile = new FloatingBarSeries("Sites fragiles");

			List<SiteFragile> sites = ReferentielServiceImpl.getInstance().getSiteFragileByBorne(graphCytog.getAlteration(), seuil);
			for (SiteFragile site : sites) {
				String libelle = site.getNom();
				String link = "Pas de lien";
				String tooltip = "<u>Nom</u> : " + libelle + "<br/>";
				tooltip += "<u>Position</u> : " + site.getChromosome() + site.getBande() + "<br/>";
				tooltip += "<u>Rareté</u> : " + site.getRarete() + "<br/>";
				long[] bornes = ReferentielServiceImpl.getInstance().getBornesByBande(site.getChromosome(), site.getBande());
				long start = bornes[0];
				long end = bornes[1];
				Color couleur;
				if (site.getRarete().equals("c")) {
					couleur = new Color(27, 154, 132);
				} else {
					couleur = new Color(149, 231, 217);
				}

				FloatingBar floatingBar = new FloatingBar(libelle, start, end, couleur, tooltip, link, couleurContour, couleurTexte);
				floatingBarseriesFragile.add(floatingBar);
			}
		}
		return floatingBarseriesFragile;
	}

	// public FloatingBarSeries getMicroRemBandes() {
	// FloatingBarSeries floatingBarseries8 = new
	// FloatingBarSeries("MicroRem. OMIM");
	// List<Microrem> microrems =
	// ReferentielServiceImpl.getInstance().getMicroRemByBorne(graphCytog.getAlteration());
	// for (Microrem microrem : microrems) {
	// int[] bornesDebut =
	// ReferentielServiceImpl.getInstance().getBornesByBande(microrem.getChromosome(),
	// microrem.getLocalisationDebut());
	// int[] bornesFin = bornesDebut;
	// String libelle = microrem.getLibelle();
	// String link = "http://omim.org/entry/" + microrem.getIdOmim();
	// String tooltip = "<u>Nom</u> : " + libelle + "<br/>";
	// tooltip += "<u>Type</u> : " + microrem.getType() + "<br/>";
	// tooltip += "<u>Position</u> : " + microrem.getChromosome() +
	// microrem.getLocalisationDebut();
	// if (microrem.getLocalisationFin() != null) {
	// tooltip += microrem.getLocalisationFin();
	// bornesFin =
	// ReferentielServiceImpl.getInstance().getBornesByBande(microrem.getChromosome(),
	// microrem.getLocalisationFin());
	// }
	// tooltip += "<br/>";
	// tooltip += "<u>Description</u> : " + microrem.getDescription();
	//
	// long start = bornesDebut[0];
	// long end = bornesFin[1];
	// Color couleur;
	// if (microrem.getType().equals("del")) {
	// couleur = GraphCytog.COLOR_CNV_1;
	// } else if (microrem.getType().equals("dup")) {
	// couleur = GraphCytog.COLOR_CNV_3;
	// } else {
	// couleur = Color.black;
	// }
	// FloatingBar floatingBar = new FloatingBar(libelle, start, end, couleur,
	// tooltip, link, couleurContour, couleurTexte);
	// floatingBarseries8.add(floatingBar);
	// }
	// return floatingBarseries8;
	// }

	public List<FloatingBarSeries> getBaseMicroRem() {
		if (floatingBarBaseMicroRem == null) {
			FloatingBarSeries floatingBarseries8 = new FloatingBarSeries("Micro del");
			FloatingBarSeries floatingBarseries9 = new FloatingBarSeries("Micro dup");
			FloatingBarSeries floatingBarseries10 = new FloatingBarSeries("Micro rem");
			List<BaseMicrorem> microrems = ReferentielServiceImpl.getInstance().getBaseMicroremByBorne(graphCytog.getAlteration(), seuil);
			for (BaseMicrorem microrem : microrems) {
				String libelle = microrem.getLibelle();
				String link = microrem.getLien();
				String tooltip = "<u>Nom</u> : " + libelle + "<br/>";
				tooltip += "<u>Position</u> : " + microrem.getChromosome() + ":" + microrem.getDebutHg19() + "-" + microrem.getFinHg19();
				long start = microrem.getDebutHg19();
				long end = microrem.getFinHg19();
				FloatingBar floatingBar = null;

				if (libelle.contains("deletion")) {
					Color couleur = GraphCytog.COLOR_CNV_0;
					floatingBar = new FloatingBar(libelle, start, end, couleur, tooltip, link, COLOR_CAUSAL1, couleurTexte);
					floatingBarseries8.add(floatingBar);
				} else if (libelle.contains("duplication")) {
					Color couleur = GraphCytog.COLOR_CNV_4;
					floatingBar = new FloatingBar(libelle, start, end, couleur, tooltip, link, COLOR_CAUSAL1, couleurTexte);
					floatingBarseries9.add(floatingBar);
				} else {
					Color couleur = new Color(255, 222, 171);
					floatingBar = new FloatingBar(libelle, start, end, couleur, tooltip, link, COLOR_CAUSAL1, couleurTexte);
					floatingBarseries10.add(floatingBar);

				}
			}
			floatingBarBaseMicroRem = new ArrayList<FloatingBarSeries>();
			floatingBarBaseMicroRem.add(floatingBarseries8);
			floatingBarBaseMicroRem.add(floatingBarseries9);
			floatingBarBaseMicroRem.add(floatingBarseries10);
		}
		return floatingBarBaseMicroRem;
	}

	public FloatingBarSeries getEuchroBandes() {
		if (floatingBarseriesEuchro == null) {
			floatingBarseriesEuchro = new FloatingBarSeries("Variant euchro.");
		}
		return floatingBarseriesEuchro;
	}

	public FloatingBarSeries getImprintingBandes() {
		if (floatingBarseriesImprinting == null) {
			floatingBarseriesImprinting = new FloatingBarSeries("Imprinting région");
			List<GeneNcbi> genesNCBI = ReferentielServiceImpl.getInstance().getImprintingByBorne(graphCytog.getAlteration(), seuil);
			for (GeneNcbi geneNcbi : genesNCBI) {
				String tumorSupp = "";
				String rm = "";
				String type = "";
				String libelle = "";
				libelle = geneNcbi.getSymbol();
				tumorSupp = geneNcbi.getTumorSupp().trim();
				rm = geneNcbi.getRm().trim();
				type = geneNcbi.getType().trim();
				String tooltip = "<u>Type</u> : " + type + "<br/>";
				if (geneNcbi.getOrientation().equals("+")) {
					tooltip += "<u>Orientation</u> : ====&gt;&gt; <br/>";
				}
				if (geneNcbi.getOrientation().equals("-")) {
					tooltip += "<u>Orientation</u> : &lt;&lt;==== <br/>";
				}

				tooltip += "<u>Nom</u> : " + geneNcbi.getDescription() + "<br/>";

				String link = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&amp;cmd=retrieve&amp;dopt=full_report&amp;list_uids=" + geneNcbi.getId().getIdNcbi();
				long start = geneNcbi.getDebutHg19();
				long end = geneNcbi.getFinHg19();

				Color couleur;
				if (type.equals("mRNA")) {
					couleur = new Color(255, 255, 102);
				} else if (type.equals("protein")) {
					couleur = new Color(255, 153, 0);
				} else if (type.equals("best RefSeq")) {
					couleur = new Color(51, 204, 0);
				} else if (type.equals("par")) {
					couleur = new Color(223, 113, 255);
					link = "";
					tooltip += "<u>Remarque</u> : région pseudo-autosomique<br/>";
				} else {
					couleur = new Color(0, 0, 0);
				}
				Color cContour = couleurContour;
				if (tumorSupp.trim().equals("Dominant")) {
					cContour = new Color(255, 0, 0);
					tooltip += "<u>Cancer</u> : Prédisposition aux cancers (Dominant)<br/>";

				} else if (tumorSupp.trim().equals("Récessif")) {
					cContour = new Color(255, 0, 0);
					tooltip += "<u>Cancer</u> : Prédisposition aux cancers (Récessif)<br/>";
				}
				if (rm.trim().equals("ASD Implicated")) {
					cContour = new Color(186, 0, 255);
					tooltip += "<u>Remarque</u> : Impliqué dans les troubles envahissants du développement (Autisme)<br/>";

				} else if (rm.trim().equals("id")) {
					cContour = new Color(186, 0, 255);
					tooltip += "<u>Remarque</u> : Impliqué dans le retard mental<br/>";
				} else if (rm.trim().equals("ASD candidate")) {
					cContour = new Color(186, 0, 255);
					tooltip += "<u>Remarque</u> : Gêne candidat pour être impliqué dans les troubles envahissants du développement (Autisme)<br/>";
				} else if (rm.trim().equals("déf.int")) {
					cContour = new Color(186, 0, 255);
					tooltip += "<u>Remarque</u> : Gênes préalablement impliqués dans la déficience intellectuelle (projet NGS MR)<br/>";
				}
				FloatingBar floatingBar = new FloatingBar(libelle, start, end, couleur, tooltip, link, cContour, couleurTexte);
				floatingBarseriesImprinting.add(floatingBar);
			}
		}
		return floatingBarseriesImprinting;
	}

	public FloatingBarSeries getProbeBandes() {
		if (floatingBarseriesProbe == null) {
			floatingBarseriesProbe = new FloatingBarSeries("Mq. de la puce");
			// Probes
			List probes = ReferentielServiceImpl.getInstance().getProbeByBorne(graphCytog.getAlteration(), seuil);
			for (Object obj : probes) {
				String libelle = "";
				String link = "Pas de lien";
				String tooltip = "";
				long start = 0;
				long end = 0;
				if (graphCytog.getAlteration().getChromosome().equals("1")) {
					Probechr1 probe = (Probechr1) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("2")) {
					Probechr2 probe = (Probechr2) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("3")) {
					Probechr3 probe = (Probechr3) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("4")) {
					Probechr4 probe = (Probechr4) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("5")) {
					Probechr5 probe = (Probechr5) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("6")) {
					Probechr6 probe = (Probechr6) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("7")) {
					Probechr7 probe = (Probechr7) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("8")) {
					Probechr8 probe = (Probechr8) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("9")) {
					Probechr9 probe = (Probechr9) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("10")) {
					Probechr10 probe = (Probechr10) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("11")) {
					Probechr11 probe = (Probechr11) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("12")) {
					Probechr12 probe = (Probechr12) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("13")) {
					Probechr13 probe = (Probechr13) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("14")) {
					Probechr14 probe = (Probechr14) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("15")) {
					Probechr15 probe = (Probechr15) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("16")) {
					Probechr16 probe = (Probechr16) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("17")) {
					Probechr17 probe = (Probechr17) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("18")) {
					Probechr18 probe = (Probechr18) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("19")) {
					Probechr19 probe = (Probechr19) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("20")) {
					Probechr20 probe = (Probechr20) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("21")) {
					Probechr21 probe = (Probechr21) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().equals("22")) {
					Probechr22 probe = (Probechr22) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().toLowerCase().equals("x")) {
					Probechrx probe = (Probechrx) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				if (graphCytog.getAlteration().getChromosome().toLowerCase().equals("y")) {
					Probechry probe = (Probechry) obj;
					tooltip = "<u>Nom</u> :" + probe.getId().getIdProbe() + "<br/>";
					tooltip += "<u>Position</u> :" + graphCytog.getAlteration().getChromosome() + " : " + probe.getId().getDebutHg19() + "-" + probe.getFinHg19();
					start = probe.getId().getDebutHg19();
					end = probe.getFinHg19();
				}
				FloatingBar floatingBar = new FloatingBar(libelle, start, end, new Color(153, 51, 10), tooltip, link, new Color(153, 51, 10), couleurTexte);
				floatingBarseriesProbe.add(floatingBar);
			}
		}
		return floatingBarseriesProbe;

	}

	public FloatingBarSeries getFishNCBIBandes() {
		FloatingBarSeries floatingBarseries6 = new FloatingBarSeries("FISH NCBI");
		// URL urlQuery;
		// try {
		// urlQuery = new
		// URL("http://www.ncbi.nlm.nih.gov/projects/mapview/map_downld.cgi?taxid=9606&build=previous&map=fish_seq&chr="
		// + chromosome + "&from=" + debut + "&to=" + fin);
		//
		// URLConnection uc = urlQuery.openConnection();
		// InputStream in = uc.getInputStream();
		// InputStreamReader ipsr = new InputStreamReader(in);
		// BufferedReader br = new BufferedReader(ipsr);
		//
		// String ligne;
		// int idligne = 1;
		// while ((ligne = br.readLine()) != null) {
		// if (idligne > 6) {
		// String[] elements = ligne.split("\t");
		// String libelle = elements[2];
		// String tooltip = elements[2];
		// String link =
		// "http://www.ncbi.nlm.nih.gov/projects/genome/clone/clname.cgi?stype=Name&list="
		// + elements[2];
		// long start = Integer.parseInt(elements[0]);
		// long end = Integer.parseInt(elements[1]);
		// Color couleur = new Color(126, 203, 239);
		// FloatingBar floatingBar = new FloatingBar(libelle, start, end,
		// couleur, tooltip, link, couleurContour, couleurTexte);
		// floatingBarseries6.add(floatingBar);
		// }
		// idligne++;
		// }
		// } catch (MalformedURLException e) {
		// // TODO Auto-generated catch block
		// e.printStackTrace();
		// } catch (IOException e) {
		// // TODO Auto-generated catch block
		// e.printStackTrace();
		// }
		return floatingBarseries6;
	}

	public HashMap<Integer, String> getPuceFamille(boolean parentsOuFreres) {
		HashMap<Integer, String> map = new HashMap<Integer, String>();
		// if (Graph.famille != null && !Graph.famille.equals("")) {
		// String[] lignes = Graph.famille.split(";;");
		// for (int i = 0; i < lignes.length; i++) {
		// String ligne = lignes[i];
		// String[] donnees = ligne.split("::");
		// String type = donnees[0];
		// Integer idP = Integer.parseInt(donnees[1]);
		// map.put(idP, type);
		// // if (parentsOuFreres
		// // && (type.equals("Père") || type.equals("Mère"))) {
		// // map.put(idP, type);
		// // } else if (!parentsOuFreres && !type.equals("Père")
		// // && !type.equals("Mère")) {
		// // map.put(idP, type);
		// // }
		// }
		// }
		return map;
	}

	public HashMap<Integer, String> getAutrePucePatient(boolean autrePuce) {
		HashMap<Integer, String> map = new HashMap<Integer, String>();
		// if (Graph.autrePucePatient != null &&
		// !Graph.autrePucePatient.equals("")) {
		// String[] lignes = Graph.autrePucePatient.split(";;");
		// for (int i = 0; i < lignes.length; i++) {
		// String ligne = lignes[i];
		// String[] donnees = ligne.split("::");
		// String type = donnees[0];
		// Integer idP = Integer.parseInt(donnees[1]);
		// map.put(idP, type);
		// }
		// }
		return map;
	}

	public String formatString(String lines) {
		String maChaine = lines;
		int NB_MAX = 100, i = 0, index = -1;

		while (i + NB_MAX < lines.length() - 1) {
			index = maChaine.substring(i, i + NB_MAX).lastIndexOf(' ');

			if (index != -1)
				maChaine = maChaine.substring(0, (index + i) + 1) + "<br/>" + maChaine.substring((index + i) + 1);

			else
				maChaine = maChaine.substring(0, i + 1) + "<br/>" + maChaine.substring(i + 1);

			i += index + 1;
		}

		return maChaine;
	}
}
